import matplotlib.pyplot as plt
import  pandas as pd

# X= [ [1,2] ,[3,4] ]
#
# plt.imshow(X)
# plt.show()


df = pd.read_excel(r'./data/data1.xls',sheet_name='高二一班')
# 中文乱码
# plt.rcParams['font.sans-serif'] = ['SimHei']
plt.rcParams['font.sans-serif'] = ['Heiti TC']
# 根据列标签 选择列
X = df.loc[:,"语文":"生物"].values
name = df['姓名']
plt.imshow(X)
# x轴刻度标签
plt.xticks(range(0,6,1),['语文','数学','英语','物理','化学','生物'])
plt.yticks(range(0,12,1),name)
# 显示颜色条
plt.colorbar()
plt.title('成绩统计热力图')
plt.show()
